package cn.wolfcode.p2p.base.domain;

import cn.wolfcode.p2p.base.util.MaskUtil;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter@Setter
public class RealAuth extends BaseAuthDomain {
    public static final int SEX_MALE = 0;//性别男
    public static final int SEX_FEMALE = 1;//性别女

    private String realName;//真实姓名
    private int sex;//性别
    private String idNumber;//身份证号码
    private String bornDate;//出生年月
    private String address;//身份证地址
    private String image1;//身份证正面
    private String image2;//身份证反面


    public String getSexDisplay(){
        return this.sex == SEX_MALE ? "男" : "女";
    }



    public String getJsonString(){
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("id",id);
        map.put("applierName", getApplier().getUsername());
        map.put("realName",realName);
        map.put("idNumber",idNumber);
        map.put("sex",getSexDisplay());
        map.put("bornDate",bornDate);
        map.put("address",address);
        map.put("image1",image1);
        map.put("image2",image2);
        return JSON.toJSONString(map);
    }
    //打码操作
    public String getAnonymousRealName() {
        return MaskUtil.getAnonymousRealName(realName);
    }
    public String getAnonymousIdNumber() {
        return MaskUtil.getAnonymousIdNumber(idNumber);
    }
    public String getAnonymousAddress() {
        return MaskUtil.getAnonymousIdNumber(address);
    }
}
